/**
 * flex-basis 规则
 */
import { UNIT_STR, NONNEGATIVE_NUMBER_REGEX_STR } from '../constant';

export default {
    regExp: new RegExp(`^flex-basis-(?<value>((?<num>${NONNEGATIVE_NUMBER_REGEX_STR})(?<unit>${UNIT_STR})?)|initial|inherit|auto)$`),
    render: function ({ groups }) {
        let { value, num, unit } = groups;
        if (num) {
            value = `${num}${unit}`;
        }
        return {
            name: 'flex-basis',
            css: [`flex-basis: ${value}`]
        }
    }
}
